gtk4.git
9 years agoAdd some content to the migration guide
Matthias Clasen [Tue, 18 Oct 2016 20:20:44 +0000 (16:20 -0400)]
Add some content to the migration guide

9 years agoStart a new migration guide
Matthias Clasen [Tue, 18 Oct 2016 19:21:12 +0000 (15:21 -0400)]
Start a new migration guide

Remove information that is only relevant for porting to GTK+ 3,
and put scaffolding in place for information relevant to GTK+ 4.

9 years agogsk: Clear the profiler instance
Emmanuele Bassi [Tue, 18 Oct 2016 15:49:21 +0000 (16:49 +0100)]
gsk: Clear the profiler instance

When disposing the GskRenderer.

9 years agogsk: Plug leak in GskRenderNode
Emmanuele Bassi [Tue, 18 Oct 2016 15:34:03 +0000 (16:34 +0100)]
gsk: Plug leak in GskRenderNode

We need to destroy the node's surface when finalizing it.

9 years agobuild: Fix variable name for gtk4-update-icon-cache target
Emmanuele Bassi [Tue, 18 Oct 2016 14:51:05 +0000 (15:51 +0100)]
build: Fix variable name for gtk4-update-icon-cache target

9 years agobuild: Rework the GSK source lising
Emmanuele Bassi [Tue, 18 Oct 2016 14:47:00 +0000 (15:47 +0100)]
build: Rework the GSK source lising

We need to only parse the public sources during the introspection step,
otherwise the introspection scanner will try to access private data
types.

9 years agobuild: Drop LDADD from GSK's Makefile
Emmanuele Bassi [Tue, 18 Oct 2016 14:29:29 +0000 (15:29 +0100)]
build: Drop LDADD from GSK's Makefile

We can use the LDFLAGS target build.

9 years agoRename all binaries to be versioned
Matthias Clasen [Tue, 18 Oct 2016 14:27:45 +0000 (10:27 -0400)]
Rename all binaries to be versioned

This is just easier to avoid parallel installation problems.

9 years agoRename gtk-query-immodules to follow our binary naming scheme
Matthias Clasen [Tue, 18 Oct 2016 13:59:42 +0000 (09:59 -0400)]
Rename gtk-query-immodules to follow our binary naming scheme

Instead of gtk-query-immodules-4.0, lets call it gtk4-query-immodules,
to use the same prefix as all the other versioned binaries.

9 years agoFix the docs build more
Matthias Clasen [Tue, 18 Oct 2016 12:56:14 +0000 (08:56 -0400)]
Fix the docs build more

This makes gtk-doc produce output again.

9 years agogdk: Fix Since tag of gdk_cairo_surface_upload_to_gl
Rico Tzschichholz [Tue, 18 Oct 2016 11:38:08 +0000 (13:38 +0200)]
gdk: Fix Since tag of gdk_cairo_surface_upload_to_gl

9 years agogdk: Add missing Since tags for gdk_window_new_child/input
Rico Tzschichholz [Tue, 18 Oct 2016 11:27:19 +0000 (13:27 +0200)]
gdk: Add missing Since tags for gdk_window_new_child/input

In addition to d22e5e69d93401f8f0a040767fbf69ac5643a19d

9 years agogsk: Bump up all version annotations
Emmanuele Bassi [Tue, 18 Oct 2016 10:37:10 +0000 (11:37 +0100)]
gsk: Bump up all version annotations

GSK is part of the 4.0 development cycle.

9 years agodocs: Bump up major version for GSK's API reference
Emmanuele Bassi [Tue, 18 Oct 2016 10:35:32 +0000 (11:35 +0100)]
docs: Bump up major version for GSK's API reference

9 years agogsk: Add the ability to create fallback renderers
Emmanuele Bassi [Thu, 25 Aug 2016 10:31:56 +0000 (11:31 +0100)]
gsk: Add the ability to create fallback renderers

While porting GTK to GskRenderer we noticed that the current fallback
code for widgets using Cairo to draw is not enough to cover all the
possible cases.

For instance, if a container widget still uses GtkWidget::draw to render
its children, and at least one of them has been ported to using render
nodes instead, the container won't know how to draw it.

For this reason we want to provide to layers above GSK the ability to
create a "fallback" renderer instance, created using a "parent"
GskRenderer instance, but using a Cairo context as the rendering target
instead of a GdkDrawingContext.

GTK will use this inside the gtk_widget_draw() implementation, if a
widget implements GtkWidgetClass.get_render_node().

9 years agogsk: Update Cairo renderer
Emmanuele Bassi [Thu, 25 Aug 2016 10:29:00 +0000 (11:29 +0100)]
gsk: Update Cairo renderer

The Cairo renderer has been lagging behind a series of changes inside
GskRenderer, like surface-less nodes, so it needs to be updated.

9 years agogsk: Make GskRenderer.render() drawing context-agnostic
Emmanuele Bassi [Wed, 24 Aug 2016 15:21:50 +0000 (16:21 +0100)]
gsk: Make GskRenderer.render() drawing context-agnostic

We're going to need to allow rendering on a specific cairo_t in order to
implement fallback code paths inside GTK; this means that there will be
times when we have a transient GskRenderer instance that does not have a
GdkDrawingContext to draw on.

Instead of adding a new render() implementation for those cases and then
decide which one to use, we can remove the drawing context argument from
the virtual function itself, and allow using a NULL GdkDrawingContext
when calling gsk_renderer_render(). A later commit will add a generic
function to create a transient GskRenderer with a cairo_t attached to
it.

Renderers inside GSK will have to check whether we have access to a
GdkDrawingContext, in which case we're going to use it; or if we have
access to a cairo_t and a window.

9 years agodocs: Update the GSK API reference section
Emmanuele Bassi [Wed, 24 Aug 2016 13:12:58 +0000 (14:12 +0100)]
docs: Update the GSK API reference section

9 years agogsk: Move GskRenderNode getters to internal API
Emmanuele Bassi [Wed, 24 Aug 2016 13:07:26 +0000 (14:07 +0100)]
gsk: Move GskRenderNode getters to internal API

GskRenderNode is, at its core, a write-only API; you're supposed to set
up the render nodes instead of querying them for state.

Querying render nodes is left to the GskRenderer implementation.

9 years agogsk: Remove GskRenderer:auto-clear
Emmanuele Bassi [Wed, 24 Aug 2016 12:47:23 +0000 (13:47 +0100)]
gsk: Remove GskRenderer:auto-clear

We control the clearing inside each GskRenderer implementation, and we
don't allow providing a target surface any more.

9 years agoConvert GtkSpinner to indirect rendering
Matthias Clasen [Thu, 18 Aug 2016 21:25:41 +0000 (17:25 -0400)]
Convert GtkSpinner to indirect rendering

9 years agoConvert GtkImage to indirect rendering
Matthias Clasen [Thu, 18 Aug 2016 20:06:31 +0000 (16:06 -0400)]
Convert GtkImage to indirect rendering

9 years agoConvert GtkAccelLabel to indirect rendering
Matthias Clasen [Thu, 18 Aug 2016 14:01:15 +0000 (10:01 -0400)]
Convert GtkAccelLabel to indirect rendering

9 years agoConvert GtkLabel to indirect rendering
Matthias Clasen [Thu, 18 Aug 2016 13:59:35 +0000 (09:59 -0400)]
Convert GtkLabel to indirect rendering

Warning! This breaks GtkAccelLabel. It will be fixed in the next
commit.

9 years agoConvert GtkFlowBox to indirect rendering
Matthias Clasen [Thu, 18 Aug 2016 06:39:08 +0000 (02:39 -0400)]
Convert GtkFlowBox to indirect rendering

9 years agocontainer: Prepare to prune render nodes
Matthias Clasen [Tue, 16 Aug 2016 16:19:48 +0000 (12:19 -0400)]
container: Prepare to prune render nodes

Add a should_propagate function for render nodes. Eventually,
this is meant to avoid creating render nodes for child widgets
that are outside the parents clip area. Since we don't have
that information available right now, just filter out nondrawable
children for now.

9 years agoSplit css background into individual render nodes
Matthias Clasen [Sat, 13 Aug 2016 08:17:35 +0000 (04:17 -0400)]
Split css background into individual render nodes

Use separate render nodes for each layer in a multi-image
background. WARNING: blend modes don't work right yet.

9 years agoAdd blend mode to debug spew
Matthias Clasen [Sat, 13 Aug 2016 08:07:38 +0000 (04:07 -0400)]
Add blend mode to debug spew

9 years agoDon't create render nodes for empty backgrounds
Matthias Clasen [Fri, 12 Aug 2016 22:23:25 +0000 (18:23 -0400)]
Don't create render nodes for empty backgrounds

9 years agoBreak out the css background render node in a function
Matthias Clasen [Fri, 12 Aug 2016 22:13:17 +0000 (18:13 -0400)]
Break out the css background render node in a function

This is in preparation for creating separate render nodes
for individual backgrounds.

9 years agoMake outer shadows work again
Matthias Clasen [Fri, 12 Aug 2016 21:13:52 +0000 (17:13 -0400)]
Make outer shadows work again

Change get_render_node to return nodes that are sized to the clip
area and expect to be placed at the clip position; change
gtk_container_propagate_render_node to place child render nodes
accordingly, and change gtk_css_gadget_get_render_node to return
nodes that are sized accordingly as well.

9 years agogsk: Fix hidpi scaling
Alexander Larsson [Tue, 16 Aug 2016 10:44:39 +0000 (12:44 +0200)]
gsk: Fix hidpi scaling

We store the vertices in (unscaled) window coords (but the item size
is still scaled to match the texture size). Also, the
projection/model-view multiplication order is switched so that the scale
is applied at the right place.

9 years agogdk_cairo_surface_upload_to_gl: Don't apply device scale
Alexander Larsson [Tue, 16 Aug 2016 09:53:49 +0000 (11:53 +0200)]
gdk_cairo_surface_upload_to_gl: Don't apply device scale

The arguments to this function is the texture width/height, and these
are already scaled.

9 years agogsk: Remove :use-alpha from GskRenderer
Emmanuele Bassi [Sat, 13 Aug 2016 07:36:59 +0000 (08:36 +0100)]
gsk: Remove :use-alpha from GskRenderer

It's unused, and we always assume we render with an alpha channel
enabled because it's 2016.

9 years agogsk: Move scaling filters to GskRenderNode
Emmanuele Bassi [Sat, 13 Aug 2016 07:34:22 +0000 (08:34 +0100)]
gsk: Move scaling filters to GskRenderNode

The renderer will always use nearest-neighbor filters because it renders
at 1:1 pixel to texel ratio.

On the other hand, render nodes may be scaled, so we need to offer a way
to control the minification and magnification filters.

9 years agogsk: Allow adding a GL texture as a node content
Emmanuele Bassi [Fri, 12 Aug 2016 15:44:29 +0000 (16:44 +0100)]
gsk: Allow adding a GL texture as a node content

If we already have a GL texture we definitely don't want to use
gdk_cairo_draw_from_gl() to draw on a Cairo context if we're going
to take the Cairo surface to which we draw and put it into an OpenGL
texture.

9 years agogsk: Drop modelview/projection from GskRenderer API
Emmanuele Bassi [Wed, 10 Aug 2016 16:50:03 +0000 (17:50 +0100)]
gsk: Drop modelview/projection from GskRenderer API

The details of the modelview and projection matrices are only useful for
the GL renderer; there's really no point in having those details
available in the generic API — especially as the Cairo fallback renderer
cannot really set up a complex modelview or a projection matrix.

9 years agogtk: Sort children by window depth when rendering
Emmanuele Bassi [Tue, 9 Aug 2016 16:10:15 +0000 (17:10 +0100)]
gtk: Sort children by window depth when rendering

This makes popovers pop over instead of under.

9 years agogsk: Ensure that non-drawing nodes are supported
Emmanuele Bassi [Tue, 9 Aug 2016 15:30:13 +0000 (16:30 +0100)]
gsk: Ensure that non-drawing nodes are supported

Non-drawing nodes should skip the texturing phase.

9 years agogtk: Add a box render node for gadgets
Emmanuele Bassi [Tue, 9 Aug 2016 15:28:43 +0000 (16:28 +0100)]
gtk: Add a box render node for gadgets

Instead of using the background as the gadget's node, we add a
non-drawing node that can be used to apply offsets; all other nodes are
children of the "box" node.

9 years agogsk: Fix the blend mode
Emmanuele Bassi [Tue, 9 Aug 2016 15:27:18 +0000 (16:27 +0100)]
gsk: Fix the blend mode

The default blend mode should be the equivalent of Cairo's OVER
operator.

9 years agogsk: Reuse VAOs with identical buffers
Emmanuele Bassi [Tue, 9 Aug 2016 10:24:05 +0000 (11:24 +0100)]
gsk: Reuse VAOs with identical buffers

Just like we reuse texture ids with the same size we can, at the expense
of a little memory, reuse vertex buffers if they reference the same
attributes and contain the same data.

Each VAO is marked as free at the end of the frame, and if it's not
reused in the following frame, it gets dropped.

9 years agogsk: Remove child-transform from render nodes
Emmanuele Bassi [Mon, 8 Aug 2016 18:34:03 +0000 (19:34 +0100)]
gsk: Remove child-transform from render nodes

The child-transform is useful only if we also provide clipping to the
parent nodes, otherwise children will just be drawn outside of the
parent's bounds.

We'll introduce child transforms either at a higher layer, or once we
add clipping support to GskRenderNode.

9 years agoCovert GtkOverlay to indirect rendering
Matthias Clasen [Sun, 7 Aug 2016 04:36:24 +0000 (00:36 -0400)]
Covert GtkOverlay to indirect rendering

There is no gadget, so we use the gtk_widget_create_render_node
function for the first time here.

9 years agoConvert GtkComboBox to indirect rendering
Matthias Clasen [Sun, 7 Aug 2016 04:03:17 +0000 (00:03 -0400)]
Convert GtkComboBox to indirect rendering

The removal of the draw method in GtkComboBox reveals another
instance of parent-child invariant violation in GtkComboBoxText.

9 years agoGtkButtonBox: Convert to indirect rendering
Matthias Clasen [Sun, 7 Aug 2016 03:45:43 +0000 (23:45 -0400)]
GtkButtonBox: Convert to indirect rendering

9 years agoSmall documentation additions
Matthias Clasen [Sun, 7 Aug 2016 03:19:40 +0000 (23:19 -0400)]
Small documentation additions

9 years agoSmall fixes for the docs
Matthias Clasen [Sun, 7 Aug 2016 03:08:04 +0000 (23:08 -0400)]
Small fixes for the docs

Set titles and short descriptions for the sections.

9 years agogsk: Build docs
Matthias Clasen [Sun, 7 Aug 2016 03:07:29 +0000 (23:07 -0400)]
gsk: Build docs

9 years agoGtkListBox: Convert to indirect rendering
Matthias Clasen [Sun, 7 Aug 2016 00:27:30 +0000 (20:27 -0400)]
GtkListBox: Convert to indirect rendering

Note that there is a problem with the pixel cache that causes
listboxes to come out black when in a scrolled window.

9 years agogadget: Fix handling of custom content
Matthias Clasen [Sun, 7 Aug 2016 00:02:49 +0000 (20:02 -0400)]
gadget: Fix handling of custom content

The transformations here were wrong, causing content to go nowhere.
This patch fixes check and radio buttons to appear as expected.

9 years agoGtkCheckButton: Convert to indirect rendering
Matthias Clasen [Sat, 6 Aug 2016 23:35:03 +0000 (19:35 -0400)]
GtkCheckButton: Convert to indirect rendering

This is another example of indirect rendering with a box gadget.
There is currently still some positioning problem with the
checkmark.

9 years agoPrevent box gadget content from being drawn twice
Matthias Clasen [Sat, 6 Aug 2016 23:33:47 +0000 (19:33 -0400)]
Prevent box gadget content from being drawn twice

Now that we split out box gadget children into separate
render nodes, we must not draw them onto the box gadgets
node anymore.

9 years agoGtkExpander: Convert to indirect rendering
Matthias Clasen [Sat, 6 Aug 2016 23:05:14 +0000 (19:05 -0400)]
GtkExpander: Convert to indirect rendering

This is the first example of indirect rendering involving
a box gadget. For now, we iterate the child gadgets manually,
and rely on gtk_container_propagate_render_node for the
child widgets. Eventually, we may want a better solution
here.

9 years agogadget: Add a has_content vfunc
Matthias Clasen [Sat, 6 Aug 2016 21:23:24 +0000 (17:23 -0400)]
gadget: Add a has_content vfunc

...and implement it for GtkCssGadget and GtkCssCustomGadget.
This allows us to decide on a per-object basis if a custom
gadget needs a render node for content or not.

9 years agobutton: Restore focus
Matthias Clasen [Sat, 6 Aug 2016 14:34:18 +0000 (10:34 -0400)]
button: Restore focus

The custom gadget draw function has the side effect of informing
the gadget machinery wether to draw focus or not. Bring the
draw function back, just for its boolean return value. We may
want to find a better solution for this.

9 years agoAllow selective debug spew
Matthias Clasen [Sat, 6 Aug 2016 14:24:05 +0000 (10:24 -0400)]
Allow selective debug spew

I don't think this should stay in the code long-term, but it
is useful for debugging. It helped me track down some suspicious
placements of render nodes.

9 years agoAdd details to css render nodes
Matthias Clasen [Sat, 6 Aug 2016 14:23:20 +0000 (10:23 -0400)]
Add details to css render nodes

Give all nodes the same detail about the owner widget.
This reveals that every GtkCssCustomGadget gets a
DrawGadgetContents node, even if their draw_func is NULL.
We may want to come up with a better solution for that.

9 years agoSome debug help
Matthias Clasen [Sat, 6 Aug 2016 13:37:47 +0000 (09:37 -0400)]
Some debug help

Make the bounds of drawing surfaces created by render nodes visible.

Trigger with GSK_DEBUG=surface.

9 years agoDrop an unused variable
Matthias Clasen [Fri, 5 Aug 2016 12:13:53 +0000 (08:13 -0400)]
Drop an unused variable

9 years agogtk: Clean up render fallback node creation in GtkWidget
Emmanuele Bassi [Thu, 4 Aug 2016 18:19:46 +0000 (19:19 +0100)]
gtk: Clean up render fallback node creation in GtkWidget

9 years agogtk: Port GtkHeaderBar to render nodes
Emmanuele Bassi [Thu, 4 Aug 2016 18:19:14 +0000 (19:19 +0100)]
gtk: Port GtkHeaderBar to render nodes

9 years agogtk: Port GtkActionBar to render nodes
Emmanuele Bassi [Thu, 4 Aug 2016 18:18:58 +0000 (19:18 +0100)]
gtk: Port GtkActionBar to render nodes

9 years agogtk: Attempt at handling CSS coordinates
Emmanuele Bassi [Thu, 4 Aug 2016 18:16:43 +0000 (19:16 +0100)]
gtk: Attempt at handling CSS coordinates

When creating the GskRenderNodes for the gadgets we should not translate
the coordinates inside the Cairo context, but we should tweak the
coordinates of the anchor point.

This is still not enough to get an appropriate rendering, as the result
is still slightly offset to the left.

9 years agogsk: Pass the appropriate value for the n_quads argument
Emmanuele Bassi [Thu, 4 Aug 2016 18:14:51 +0000 (19:14 +0100)]
gsk: Pass the appropriate value for the n_quads argument

Instead of passing the size of the buffer, we should pass the number of
quads; we know what the size of a single quad structure is, so we can do
the multiplication internally when creating the VAO.

This allows us to print the quads for debugging purposes.

9 years agoGtkFrame: Convert to indirect rendering
Matthias Clasen [Wed, 3 Aug 2016 01:26:03 +0000 (21:26 -0400)]
GtkFrame: Convert to indirect rendering

Create a GskRenderNode for the contents of the frame.

9 years agogtk: Add convenience function for creating render nodes
Emmanuele Bassi [Thu, 4 Aug 2016 14:22:00 +0000 (15:22 +0100)]
gtk: Add convenience function for creating render nodes

GtkWidget.create_render_node() sets up a GskRenderNode appropriate for
rendering the contents of a widget, including its bounds,
transformation, and anchor point.

9 years agogsk: Rename set_offset() to set_anchor_point()
Emmanuele Bassi [Thu, 4 Aug 2016 14:20:06 +0000 (15:20 +0100)]
gsk: Rename set_offset() to set_anchor_point()

The naming is consistent with other scene graph libraries, as it
represents an additional translation transformation applied on top of
the provided transformation matrices.

We can also simplify the implementation by applying the translation when
we compute the world matrix.

9 years agogsk: Recycle textures across frames
Emmanuele Bassi [Thu, 4 Aug 2016 11:37:54 +0000 (12:37 +0100)]
gsk: Recycle textures across frames

We keep the textures used inside a frame around until the end of the
following frame; whenever we need a texture with the same size, and
it's not marked in use, then we just reuse the existing texture.

9 years agoFix fallback render nodes
Matthias Clasen [Thu, 4 Aug 2016 05:05:14 +0000 (01:05 -0400)]
Fix fallback render nodes

We were allocating a surface thats big enough for the clip, and
we were setting the transform for that, but then GtkContainer
was overriding the transform with the one for the allocation.
Also, we were drawing at the clip position, not the allocation
position.

9 years agoAdd an offset to render nodes
Matthias Clasen [Thu, 4 Aug 2016 05:04:25 +0000 (01:04 -0400)]
Add an offset to render nodes

This will let us account for the difference between
clip and allocation.

9 years agogsk: Split of debug spew for transforms
Matthias Clasen [Wed, 3 Aug 2016 02:00:50 +0000 (22:00 -0400)]
gsk: Split of debug spew for transforms

This was overwhelming other useful debug output, so make it
opt-in. We print the render items for both opengl and transforms,
since the matrices bleed into each other, otherwise.

9 years agogsk: Add debug macros that trigger on two conditions
Matthias Clasen [Wed, 3 Aug 2016 01:56:17 +0000 (21:56 -0400)]
gsk: Add debug macros that trigger on two conditions

This will be useful in the following commits.

9 years agogsk: Add a debug flag for transforms
Matthias Clasen [Wed, 3 Aug 2016 01:53:31 +0000 (21:53 -0400)]
gsk: Add a debug flag for transforms

9 years agogsk: Improve debug output a bit
Matthias Clasen [Wed, 3 Aug 2016 01:52:30 +0000 (21:52 -0400)]
gsk: Improve debug output a bit

Indent render node debug spew to make the tree structure obvious.

9 years agobutton: Convert to indirect rendering
Matthias Clasen [Wed, 3 Aug 2016 00:13:21 +0000 (20:13 -0400)]
button: Convert to indirect rendering

WARNING! This commit breaks GtkButton subclasses.

9 years agoConvert GtkGrid to indirect rendering
Matthias Clasen [Tue, 2 Aug 2016 23:45:47 +0000 (19:45 -0400)]
Convert GtkGrid to indirect rendering

Following the example of GtkBox.

9 years agogsk: Add GskProfiler to GskRenderer
Emmanuele Bassi [Wed, 3 Aug 2016 15:51:21 +0000 (16:51 +0100)]
gsk: Add GskProfiler to GskRenderer

The profiler instance is per-renderer, and is accesible to
implementations.

9 years agogsk: Add profiler object
Emmanuele Bassi [Wed, 3 Aug 2016 15:48:49 +0000 (16:48 +0100)]
gsk: Add profiler object

The GskProfiler holds counters and timers, and will be used by the
renderer implementations to acquire frame timings.

9 years agobox: Port from immediate to deferred rendering
Emmanuele Bassi [Tue, 2 Aug 2016 17:44:06 +0000 (18:44 +0100)]
box: Port from immediate to deferred rendering

Drop the ::draw() vfunc implementation in favour of the
::get_render_node() vfunc.

9 years agoIntegrate CSS gadget with GSK render nodes
Emmanuele Bassi [Tue, 2 Aug 2016 17:42:51 +0000 (18:42 +0100)]
Integrate CSS gadget with GSK render nodes

First stab at an internal API that generates render nodes when drawing a
CSS gadget.

9 years agogtk: Update the coordinates when propagating render nodes
Emmanuele Bassi [Tue, 2 Aug 2016 16:01:08 +0000 (17:01 +0100)]
gtk: Update the coordinates when propagating render nodes

Just like gtk_container_propagate_draw() does for the immediate mode
rendering.

9 years agoUse the projection to flip around the content
Emmanuele Bassi [Tue, 2 Aug 2016 15:58:47 +0000 (16:58 +0100)]
Use the projection to flip around the content

Since we use an FBO to render the contents of the render node tree, the
coordinate space is going to be flipped in GL. We can undo the flip by
using an appropriate projection matrix, instead of changing the sampling
coordinates in the shaders and updating all our coordinates at render
time.

9 years agowidget: Fix compatibility fallbacks
Emmanuele Bassi [Mon, 1 Aug 2016 15:19:31 +0000 (16:19 +0100)]
widget: Fix compatibility fallbacks

9 years agogsk: Add texture size to debug message
Emmanuele Bassi [Thu, 28 Jul 2016 15:20:26 +0000 (16:20 +0100)]
gsk: Add texture size to debug message

9 years agogsk: Take into account the scaling factor
Emmanuele Bassi [Wed, 27 Jul 2016 15:48:35 +0000 (16:48 +0100)]
gsk: Take into account the scaling factor

We need to apply a scaling factor whenever we deal with user-supplied
coordinates, like:

 - when creating textures
 - when setting up the viewport
 - when submitting the scene

9 years agogsk: Tie render nodes to renderers
Emmanuele Bassi [Wed, 27 Jul 2016 15:23:44 +0000 (16:23 +0100)]
gsk: Tie render nodes to renderers

Render nodes need access to rendering information like scaling factors.
If we keep render nodes separate from renderers until we submit a nodes
tree for rendering we're going to have to duplicate all that information
in a way that makes the API more complicated and fuzzier on its
semantics.

By having GskRenderer create GskRenderNode instances we can tie nodes
and renderers together; since higher layers will also have access to
the renderer instance, this does not add any burden to callers.

Additionally, if memory measurements indicate that we are spending too
much time in the allocation of new render nodes, we can now easily
implement a free-list or a renderer-specific allocator without breaking
the API.

9 years agogsk: Bind GL context to the GL profiler
Emmanuele Bassi [Wed, 27 Jul 2016 10:34:20 +0000 (11:34 +0100)]
gsk: Bind GL context to the GL profiler

Similarly to how we bind it to the GL driver object used by the GSK GL
renderer.

9 years agogtk: Port GtkWindow to render nodes
Emmanuele Bassi [Wed, 27 Jul 2016 08:42:25 +0000 (09:42 +0100)]
gtk: Port GtkWindow to render nodes

WARNING: BROKEN COMMIT

9 years agogtk: Add GtkContainer API to gather render nodes
Emmanuele Bassi [Wed, 27 Jul 2016 08:40:29 +0000 (09:40 +0100)]
gtk: Add GtkContainer API to gather render nodes

We cannot implement GtkWidgetClass.get_render_node() in GtkContainer
without breaking the fallback path that renders a widget to a single
render node rasterization. For GtkContainer subclasses we should provide
a simple API, similar to gtk_container_propagate_draw(), that gathers
all the render nodes for each child.

9 years agogtk: Name GSK render nodes
Emmanuele Bassi [Wed, 27 Jul 2016 08:39:55 +0000 (09:39 +0100)]
gtk: Name GSK render nodes

For debugging purposes it's helpful to name the nodes.

9 years agogsk: Fix build without Wayland
Emmanuele Bassi [Mon, 25 Jul 2016 16:36:33 +0000 (17:36 +0100)]
gsk: Fix build without Wayland

9 years agogsk: Add redirection to FBOs for opacity groups
Emmanuele Bassi [Mon, 25 Jul 2016 16:15:05 +0000 (17:15 +0100)]
gsk: Add redirection to FBOs for opacity groups

If a node is non-opaque and has a non-zero opacity we need to paint its
contents and children first to an off screen buffer, and then render the
resulting texture at the desired opacity — otherwise the opacities will
combine and result in the wrong rendering.

9 years agogsk: Drop opaque/transparent item split
Emmanuele Bassi [Thu, 21 Jul 2016 16:19:53 +0000 (17:19 +0100)]
gsk: Drop opaque/transparent item split

We're not going to use separate rendering lists soon, and the way we
render items is less similar to a gaming engine and more similar to a
simpler compositor. This means we don't need to perform a two pass
rendering — opaque items first, transparent items later.

9 years agogsk: Rename uniforms and attributes in shaders
Emmanuele Bassi [Thu, 21 Jul 2016 16:17:49 +0000 (17:17 +0100)]
gsk: Rename uniforms and attributes in shaders

Use appropriate names, and annotate the names with the types — 'u' for
uniforms, 'a' for attributes. The common preambles for shaders are split
from the bodies, so we need some way to distinguish the uniforms and the
attributes just from their name.

9 years agogsk: Move resource handling inside GskGLDriver
Emmanuele Bassi [Wed, 20 Jul 2016 16:55:35 +0000 (17:55 +0100)]
gsk: Move resource handling inside GskGLDriver

We want the GL driver to cache as many resources as possible, so we can
always ensure that we're in a consistent state, and we can handle state
transitions more appropriately.

9 years agogsk: Simplify buffer handling in GskGLRenderer
Emmanuele Bassi [Tue, 19 Jul 2016 13:42:54 +0000 (14:42 +0100)]
gsk: Simplify buffer handling in GskGLRenderer

We don't have optional stencil and depth buffers, like GtkGLArea: we
always create both of them internally.

9 years agogsk: Drop render buffer code path from GskGLRenderer
Emmanuele Bassi [Tue, 19 Jul 2016 13:34:24 +0000 (14:34 +0100)]
gsk: Drop render buffer code path from GskGLRenderer

We always use texturing, to preserve the alpha channel when blitting the
frame buffer object on the window surface.

9 years agogsk: Rework surface -> texture API
Emmanuele Bassi [Tue, 19 Jul 2016 13:32:17 +0000 (14:32 +0100)]
gsk: Rework surface -> texture API

Drop the texture parameters handling from the texture creation, and
associate them with the contents upload. Also, rename the function to
something more in line with what it does.

9 years agogsk: Add GL driver API to create render targets
Emmanuele Bassi [Tue, 12 Jul 2016 14:41:31 +0000 (15:41 +0100)]
gsk: Add GL driver API to create render targets

It's going to be used by the GL renderer to safely create and bind
FBOs when needed.